Scripting Tutorial: Raw



The Raw event allows you to process numeric server messages that are identified only by a number, and non-numeric server messages which mIRC doesn't recognize internally. An example of a Raw event would be this: You message a nick YahooBug which's not on IRC. In the mIRC window you see "YahooBug no such nick/channel". What happened was: When you sent a message to a non-existant nick, the IRC server sent a numeric response of 401 with three parameters to mIRC and mIRC translated it to an echo "YahooBug no such nick/channel".

The first parameter is your nick, the second parameter is the non-existant nick and the third parameter is the raw message. Echoing "YahooBug no such nick/channel" was the default response of mIRC to the raw numeric 401. Now using raw event Remotes you can change the way Raw numerics are handled by mIRC. Let's try that for raw numeric 401.

raw 401:*: echo -a Whether a nick or a channel, $2 doesn't exist. | halt

When you put this in the Remotes, the next time you message a non-existant nick (YahooBug) you will see "Whether a nick or a channel, YahooBug doesn't exist". You won't see the "YahooBug no such nick/channel" echo anymore. Note: $2 indicates the non-existant nick or the channel you tried to message or notice to. In a Raw event $1 stands for your nick.

The format for handling Raw events is: raw <numeric>:<matchtext>:<command>

You don't create a separate Raw file to write your Raw remote files. You can include a Raw event handler in any of your remote files or separately if needed. Apart from the minor differences in the event definition, Raw and Remote are similar in working.

To see IRC in the Raw mode type /debug on in mIRC, chat for sometime and open the debug.log file in the mIRC directory using NotePad. Or you can IRC from Telnet. The method is explained in the article IRC Clients - How they Work. But I would say the best and the easiest way would be to use Spyder IRC-Master. In all of these, the numbers you see after the server name is the Raw numeric.

Here's what the mIRC Help File's got to say about Raw events:

As a quick example, the following script filters out the channels list numeric when you use the /list command.

raw 322:*mirc*:/echo 5 $1-

The above script matches numeric 322 which is the channels /list numeric and if the line returned by this numeric has the word mirc in it, it is printed out in the status window.

You can process non-numeric server messages by specifying the name of the event: raw PROP:*mirc*:/echo 5 $1-
Note: You can prevent most raw server messages from printing out their default text by using the /halt command.

Raw numeric responses can be used in many ways, it all depends on your necessity and creativity. One example of Raw response which I used is in SpyderChat is: When you get a 401 response, /notify $2 and when you are notified of $2, remove $2 from the notify list; this is how SpyderChat shows the online status of a nick in it's status bar.

Now you may wonder what the Raw Numerics for other events are. Since there are a lot of events, I can't list here the raw numeric for all of them. For that you may download Jeepster's IRC Numeric Reference to refer to the raw numerics. It includes Jeepster's IRC Numeric Parser, a script which shows the numeric and various parameters as you connect to IRC and chat. The Jeepster's IRC Numeric Reference is an indispensable tool for anyone serious about mIRC scripting.

If you have gotten the way Remotes work, I can say for sure you won't have any problem understanding Raw Remote events. All you require is to know the Raw Numerics which can be found in the IRC Numeric Reference by Jeepster. Next we move on to Access Levels. Not my favorite, I never use it actually but will be covering it just to make the Tutorial complete.


Back | Table of Contents | Access Levels



Copyright © 2002-2004 SpyderWares.
Feel free to distribute this tutorial in part or whole, just make sure the credits stay intact.

http://spyderwares.com